package com.base.cn.platform.os.service.manage.op.coupon;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@FeignClient(name = BaseService.appName , configuration = FeignAuthConfig.class)
public interface OpCouponCodeService extends BaseService {

    /**
     * 修改优惠券编码状态
     * @param codeId 优惠券编码ID
     * @param status 状态
     */
    @RequestMapping(contextPath + "/op/updateCouponCodeStatus")
    void updateCouponCodeStatus(@RequestParam("codeId") BigDecimal codeId, @RequestParam("status") int status);

    /**
     * 通过编码获取优惠券对象
     * @param code 优惠编码
     * @param couponData 是否设置优惠券数据对象
     * @return OpCouponCode
     */
    @RequestMapping(contextPath + "/op/findCouponCodeByCode")
    Map<String,Object> findCouponCodeByCode(@RequestParam("code") String code, @RequestParam("couponData") boolean couponData);


    /**
     * 通过编码获取优惠券对象
     * @param id 优惠券编码ID
     * @param couponData 是否设置优惠券数据对象
     * @return OpCouponCode
     */
    @RequestMapping(contextPath + "/op/findCouponCodeById")
    Map<String,Object> findCouponCodeById(@RequestParam("id") BigDecimal id,
                                          @RequestParam("couponData") boolean couponData);

    /**
     * 翻页搜索优惠券编码
     * @param opCouponCode
     * @param currentPage
     * @param userName
     * @param couponData
     * @return
     */
    @RequestMapping(contextPath + "/op/queryOpCouponCodeListPage")
    Map<String,Object> queryOpCouponCodeListPage(@RequestBody Map<String, Object> opCouponCode,
                                                 @RequestParam(value = "currentPage", required = false, defaultValue = "1") Integer currentPage,
                                                 @RequestParam("userName") boolean userName,
                                                 @RequestParam("couponData") boolean couponData);

    /**
     * 搜索优惠券编码
     * @param userId
     * @param status
     * @param userName
     * @param couponData
     * @return
     */
    @RequestMapping(contextPath + "/op/queryUserCouponCodeListByUserId")
    List<Map<String,Object>> queryUserCouponCodeListByUserId(@RequestParam("userId") BigDecimal userId, @RequestParam("status") Integer status,
                                                             @RequestParam("userName") boolean userName,
                                                             @RequestParam("couponData") boolean couponData);

    /**
     * 批量查询
     * @param opCouponCode
     * @param userName
     * @param couponData
     * @return
     */
    @RequestMapping(contextPath + "/op/queryUserCouponCodeList")
    List<Map<String,Object>> queryUserCouponCodeList(@RequestBody Map<String, Object> opCouponCode,
                                                     @RequestParam(value = "userName", required = false, defaultValue = "false") boolean userName,
                                                     @RequestParam(value = "couponData", required = false, defaultValue = "false") boolean couponData);

    /**
     * 个人中心专用搜索列表
     *
     * @param currentPage   翻页
     * @param order  分组
     * @param status 优惠券状态
     * @param type 优惠券类型
     * @param userId 用户id
     */
    @RequestMapping(contextPath + "/op/queryUserCouponCode")
    Map<String,Object> queryUserCouponCode(@RequestParam(value = "currentPage", required = false, defaultValue = "1") Integer currentPage,
                                           @RequestParam(value = "order", required = false, defaultValue = "0") Integer order,
                                           @RequestParam(value = "status", required = false, defaultValue = "0") Integer status,
                                           @RequestParam(value = "type", required = false, defaultValue = "0") Integer type,
                                           @RequestParam("userId") BigDecimal userId,
                                           @RequestParam(value = "userName", required = false, defaultValue = "false") boolean userName,
                                           @RequestParam(value = "couponData", required = false, defaultValue = "false") boolean couponData);

    /**
     * 查询订单可用的优惠券（只用于存课程商品的订单）
     * @param paramsList 查询条件
     * @param userId 用户ID
     * @return List<OpCouponCode>
     */
    @RequestMapping(contextPath + "/op/findOrderAvailableCodeList")
    List<Map<String,Object>> findOrderAvailableCodeList(@RequestBody List<Map<String, String>> paramsList, @RequestParam("userId") BigDecimal userId);

    /**
     * 赠送用户优惠券
     * @param userId 用户ID
     * @param conditions 获取条件，1手动发放，2新用户注册后自动获取，3学员生日获取，4邀请注册获取，5消费任意金额获取，6免费直播发放，7活动
     * @param count 获取数量(如果数量为0量，则获取该类型的所有的优惠券的各一张编码)
     */
    @RequestMapping(contextPath + "/op/giveUserCouponCode")
    void giveUserCouponCode(@RequestParam("userId") BigDecimal userId,
                            @RequestParam("conditions") int conditions,
                            @RequestParam("count") int count);

    /**
     * 新用户注册后赠送优惠券
     * @param userId 用户ID
     */
    @RequestMapping(contextPath + "/op/giveUserRegCouponCode")
    void giveUserRegCouponCode(@RequestParam("userId") BigDecimal userId);

    /**
     * 用户注册赠送优惠券
     * @param userId 用户ID
     */
    @RequestMapping(contextPath + "/op/giveUserBirthdayCode")
    void giveUserBirthdayCode(@RequestParam("userId") BigDecimal userId);

    /**
     * 用户消费任意金额赠送优惠券
     * @param userId 用户ID
     */
    @RequestMapping(contextPath + "/op/giveUserConsumePrice")
    void giveUserConsumePrice(@RequestParam("userId") BigDecimal userId);

    /**
     * 赠送用户参加免费直播直播赠送优惠券
     * @param userId 用户ID
     * @param openCourseId　免费直播ID
     */
    @RequestMapping(contextPath + "/op/giveUserCourseOpenCode")
    void giveUserCourseOpenCode(@RequestParam("userId") BigDecimal userId,
                                @RequestParam("openCourseId") BigDecimal openCourseId);

    /**
     * 用户参加活动赠送优惠券
     * @param userId 用户ID
     * @param activityId 活动ID
     */
    @RequestMapping(contextPath + "/op/giveActivityUserCode")
    void giveActivityUserCode(@RequestParam("userId") BigDecimal userId,
                              @RequestParam("activityId") BigDecimal activityId);
}
